import request from '@/utils/request'

// 根据章节id查询资源列表
export function listResByChapterId(query) {
  return request({
    url: '/course/res/listByChapterId',
    method: 'get',
    params: query
  })
}

// 查询资源列表
export function listRes(query) {
  return request({
    url: '/course/res/list',
    method: 'get',
    params: query
  })
}

// 查询资源详细
export function getRes(resId) {
  return request({
    url: '/course/res/' + resId,
    method: 'get'
  })
}

// 查询资源详细
export function listResByIds(params) {
  return request({
    url: '/course/res/listByIds',
    method: 'get',
    params: params
  })
}

// 新增资源
export function addRes(data) {
  return request({
    url: '/course/res',
    method: 'post',
    data: data
  })
}

// 修改资源
export function updateRes(data) {
  return request({
    url: '/course/res',
    method: 'put',
    data: data
  })
}

// 删除资源
export function delRes(resId) {
  return request({
    url: '/course/res/' + resId,
    method: 'delete'
  })
}
